package controller

import (
	barcode "ez/custom"
	"ez/custom/cc"
	"gitee.com/dreamwood/ez-go/ez"
	"gitee.com/dreamwood/ez-go/ezc"
)

type BarController struct {
	ezc.BaseAdminController
}

func init() {
	c := &BarController{}
	c.SetRouteParam("/mes", "/admin", "Bar")
	ez.CreateApi(c.AdminModelApi("get"), c.BarGetAction)
	//ez.CreateApi(c.R("/barcode"), c.BarGetAction)
}

func (c BarController) BarGetAction(session *ez.Session) {
	this := cc.New(session)
	text := this.Get("text").IsString()

	barcode.CreateBarBase64(text)
	this.Html("data:image/png;base64," + barcode.CreateBarBase64(text))
}
